//
//  ESFacialCollectionViewCell.m
//  SportsGather
//
//  Created by fuyoufang on 15/10/18.
//  Copyright (c) 2015年 Egymcom. All rights reserved.
//

#import "ESFacialCollectionViewCell.h"

@interface ESFacialCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIButton *emojiButton;

@end

@implementation ESFacialCollectionViewCell

- (void)awakeFromNib {
    // Initialization code

}
- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self = [[[NSBundle mainBundle] loadNibNamed:@"ESFacialCollectionViewCell" owner:nil options:nil] lastObject];
        self.contentView.backgroundColor = [UIColor blueColor];
    }
    return self;
}
+ (instancetype)cellWith:(UICollectionView *)collectionView forIndexPath:(NSIndexPath *)indexPath {
    ESFacialCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:FacialCellReuseIdentifier forIndexPath:indexPath];
    return cell;
    
}

- (void)setFacial:(ESFacial *)facial {
    _facial = facial;
    if (facial.emoji) {
        [self.emojiButton setTitle:facial.emoji forState:UIControlStateNormal];
    } else if (facial.pictureName) {
        [self.emojiButton setImage:[UIImage imageNamed:facial.pictureName] forState:UIControlStateNormal];
    }
}

@end
